<template>
	<view>
		<view class="container">
			<view class="background-color" :style="'background:' + mobile_head_color">
				<view class="topbox">
					<view class="phone">当前小区：{{village_name}}；所属车库：{{listData.garage_num}}；车位号：{{listData.position_num}}；车牌号：{{listData.car_number}}</view>
					<!-- <view class="address-box1">
						<view class="address-icon">
							<image src="../../../static/images/address.png" class="address-img"></image>
						</view>
					</view> -->
				</view>
			</view>
			<!-- <view class="title">储值账户余额</view>
			<input type="text" class="inp-box" v-model="pay_name" value="" placeholder-style="font-size: 28rpx;font-weight: normal;font-stretch: normal;line-height: 60rpx;letter-spacing: 0rpx;color: #c3c3c3;"
			 placeholder="请填写缴费的事项" /> -->
			<view class="title">储值账户余额</view>
			<input type="digit" class="inp-box" v-model="money" value="" placeholder-style="font-size: 28rpx;font-weight: normal;font-stretch: normal;line-height: 60rpx;letter-spacing: 0rpx;color: #c3c3c3;"
			 placeholder="请输入缴纳的费用（元）" />
			<view class="btn">
				<button type="primary" :style="btn_style" class="btn-pry" @tap="uPublishTap">去缴费</button>
			</view>
		</view>
	</view>
</template>

<script>
	var common = require('../../../utils/common.js');
	var app = getApp();
	var _this;
	const getpayMentlist = () => {
		common.post('HouseApi&a=stored_pay_info', {
			village_id: _this.village_id,
			car_id: _this.car_id,
		}, data => {
			console.log('+++++++++++++', data)
			_this.listData = data.info;
			// common.parseUrl(data.order_url)
		});
	};
	const getpayMent = () => {
		var money = Number(_this.money)
		common.post('HouseApi&a=park_go_pay', {
			village_id: _this.village_id,
			pigcms_id: _this.pigcms_id,
			money: _this.money,
			car_type:_this.car_type,
			month_end_time: _this.end_time,
			car_id: _this.car_id,
			type: 'park',
		}, data => {
			console.log('+++++++++++++', data)
			common.parseUrl(data.order_url)
		});
	};

	export default {
		data() {
			return {
				listData: {},
				village_id: 0,
				pigcms_id: 0,
				village_name: '',
				money: '',
				pay_name: '',
				url: '',
				actcolor: '',
				btn_style: '',
				address: '',
				car_id:'',
			}
		},
		onShow() {
			// #ifdef H5
			common.hideWxShare()
			// #endif
		},
		onLoad(options) {
			_this = this;
			_this.car_id = options.car_id;
			_this.car_type = options.car_type;
			// #ifdef H5
			console.log('准备跳小程序页', _this);
			common.webToMiniapp(_this.route, options, 'redirect')
			// #endif

			common.setMainColor(_this, function(config) {
				console.log("config", config)
				_this.actcolor = config.config.mobile_head_color
				_this.btn_style = 'background-color: ' + _this.actcolor + ';box-shadow:0px 30rpx 30rpx -30rpx ' + _this.actcolor +
					';';
				const res = uni.getStorageSync('village_key');
				if (res) {
					_this.village_id = res.village_id;
					_this.pigcms_id = res.pigcms_id;
					_this.village_name = res.village_name;
				};
				getpayMentlist()
			});

		},
		methods: {
			uPublishTap() {
				getpayMent()
			}
		},
		components: {

		},
	}
</script>

<style>
	page {
		background: rgb(245, 245, 245);
	}

	.container {
		margin: 0;
		padding: 0;
	}

	.topbox {
		display: flex;
		flex-direction: column;
		background-size: 30%;
	}

	.phone {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 40rpx;
		letter-spacing: 0rpx;
		padding: 30rpx 30rpx;
		color: #ffffff;
	}

	.address-box1 {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		margin-top: 10rpx;
	}

	.address-icon {
		width: 20rpx;
		height: 24rpx;
		flex-shrink: 0;
		margin-top: 9rpx;
	}

	.address-img {
		width: 100%;
		height: 100%;
		display: block;
	}

	.address-text {
		font-size: 24rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 40rpx;
		letter-spacing: 0px;
		color: #ffffff;
		margin-left: 15rpx;
	}

	.title {
		margin-left: 30rpx;
		font-size: 26rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 50px;
		letter-spacing: 0rpx;
		color: #333333;
	}

	.inp-box {
		background: #FFFFFF;
		margin: 0rpx 30rpx;
		padding: 30rpx;
		border-radius: 10rpx;
	}

	.btn {
		margin: 74rpx 0rpx;
		height: 100%;
		width: 100%;
	}

	.btn-pry {
		width: 550rpx;
		height: 98rpx;
		background: #2681f3;
		border-radius: 49rpx;
		line-height: 98rpx;
		margin-top: 220rpx;
	}
</style>
